package cn.snmp.mutual.nms;

public class SnmpOpaque extends SnmpString
{
    private SnmpVar var;
    
    SnmpOpaque() {
        this.var = null;
    }
    
    public SnmpOpaque(final SnmpVar snmpvar) {
        this(ASNTypes.encodeVariable(snmpvar));
    }
    
    public SnmpOpaque(final String s) {
        super(s);
        this.var = null;
        this.Type = 68;
    }
    
    public SnmpOpaque(final byte[] abyte0) {
        super(abyte0);
        this.var = null;
        this.Type = 68;
    }
    
    public SnmpVar decodeVariable() throws SnmpException {
        if (this.var == null) {
            this.var = ASN1Parser.decodeVariable(this.byteValue);
        }
        return this.var;
    }
    
    @Override
    int encode(final byte[] abyte0, final int i) throws ArrayIndexOutOfBoundsException {
        return ASNTypes.encodeOctets(abyte0, i, this.byteValue, 0, this.byteValue.length, 68);
    }
    
    static SnmpVar newInstance(final byte[] abyte0) {
        final SnmpOpaque snmpopaque = new SnmpOpaque();
        snmpopaque.Type = 68;
        snmpopaque.byteValue = abyte0;
        return snmpopaque;
    }
    
    @Override
    public String toTagString() {
        return "OPAQUE : " + this.toString();
    }
}
